package com.junxonline.instant.admin.controller.console;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.junxonline.instant.dao.entity.vo.console.ConsoleVO;
import com.junxonline.instant.admin.service.console.ConsoleService;
import com.junxonline.instant.common.annotation.OperationLog;
import com.junxonline.instant.common.entity.common.CommonResult;
import com.junxonline.instant.common.enumeration.OperationEnum;
import lombok.extern.log4j.Log4j2;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 控制台Controller
 *
 * @author JunX
 * @date 2021-07-06
 */
@Log4j2
@RestController
@RequestMapping(value = "/console")
public class ConsoleController {

    @Autowired
    private ConsoleService consoleService;

    /**
     * 获取控制台统计数据
     *
     * @param vo 请求参数
     * @return CommonResult
     */
    @RequiresPermissions(value = "console:query")
    @OperationLog(label = "控制台-获取统计数据", type = OperationEnum.QUERY)
    @PostMapping(value = "/getStatisticsData")
    public CommonResult getStatisticsData(@RequestBody(required = false) ConsoleVO vo) {
        return CommonResult.success(consoleService.getStatisticsData(vo, new QueryWrapper()));
    }

}
